//
//  SubViewController.m
//  HouseShow
//
//  Created by gongjie on 11-12-28.
//  Copyright (c) 2011年 __MyCompanyName__. All rights reserved.
//

#import "SubViewController.h"
#import "PInformationViewController.h"


@implementation SubViewController
@synthesize delegate;
//- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
//{
//    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
//    if (self) {
//        // Custom initialization
//    }
//    return self;
//}

- (void)didReceiveMemoryWarning
{
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
    
    // Release any cached data, images, etc that aren't in use.
}

#pragma mark - View lifecycle

/*
// Implement loadView to create a view hierarchy programmatically, without using a nib.
- (void)loadView
{
}
*/

// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad
{
   // [super viewDidLoad];
    self.title = @"标题";
        self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemRefresh target:self action:@selector(changelist)];
    [self.view setBackgroundColor:[UIColor whiteColor]];
    _web = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width-80 , self.view.frame.size.height)];
    _web.delegate = self;
    _login = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite];
    _login.frame = CGRectMake(_web.frame.size.width/2-25, _web.frame.size.height/2-130, 50, 50);
    [self.view addSubview:_web];
    [self.view addSubview:_login];
}
-(void)startlist:(NSString*)ulr
{
    [_web loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:ulr]]];
    [_login startAnimating];
}


- (void)webViewDidStartLoad:(UIWebView *)webView
{
   
}
- (void)webViewDidFinishLoad:(UIWebView *)webView
{
    [_login stopAnimating];
}
-(void)changelist
{
   	if (delegate !=nil&& [delegate conformsToProtocol:@protocol(SubDelegate)]) {
        if([delegate respondsToSelector:@selector(Revocation)]) {
            [delegate performSelector:@selector(Revocation)];
        }
    }
}
- (void)viewDidUnload
{
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
-(void)dealloc
{
    [_web release];
    delegate = nil;
     [_login release];
    [super dealloc];
}
@end
